#include <stdio.h>

#define N 100

int n,m,sum,a[N],b[N],pick[N];

int main()
{
	scanf("%d%d",&n,&m);
	for (int i = 0; i < n; ++i)
	{
		scanf("%d",&a[i]);
		pick[i] = 0;
	}
	for (int i = 0; i < n; ++i)
	{
		scanf("%d",&b[i]);
	}
	sum = 0;
	for (int i = 0; i < n; ++i)
	{
		int max = -1,max_id = -1;
		for (int j= 0; j < n; ++j)
		{
			if(pick[j] == 0 && a[j] > max)
			{
				max = a[j];
				max_id = j;
			}
		}
		sum += max;
		pick[max_id] = 1;
		for(int j = 0;j < n;++j)
		{
			a[j] -= b[j];
		}
	}
	return 0;
}